/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * <p>Project: javase - Img6
 * <p>Powered by webrx On 2021-12-17 19:06:43
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Img6 {
    public static void main(String[] args) throws IOException {

        int w = 800;
        int h = 600;
        BufferedImage i = new BufferedImage(w, h, 1);
        Graphics g = i.getGraphics();
        g.setColor(Color.RED);
        g.fillRect(0, 0, w, h);
        g.setColor(Color.WHITE);
        int xx = 400, yy = 300;//坐标中心
        int angle = 0;//角度
        int cw = 200, ch = 200;//控制圆形的水平直径 垂直直径
        for (int n = 0; n <= 36; n++) {
            int x = xx - (int) (Math.sin(angle * Math.PI / 360) * cw);
            int y = yy - (int) (Math.cos(angle * Math.PI / 360) * ch);
            g.fillOval(x, y, 10, 10);
            angle += 20;
        }
        g.dispose();
        ImageIO.write(i, "jpg", new File("c:/b.jpg"));

    }
}
